class Solution(object):
    def clumsy(self, n):
        st = [n]
        state = 0
        for k in range(n - 1, 0, -1):
            if state == 0:
                st[-1] *= k
                state = 1
            else:
                if state == 1:
                    if st[-1] > 0:
                        st[-1] //= k
                    else:
                        st[-1] = -((-st[-1]) // k)
                    state = 2
                else:
                    if state == 2:
                        st.append(k)
                        state = 3
                    else:
                        st.append(-k)
                        state = 0
        return sum(st)


data = Solution()
n = 10
print(data.clumsy(n))
